from __future__ import annotations

from dataclasses import dataclass
from math import cos, radians


@dataclass
class DerrickSystem:
    mast_axial_kN: float
    mast_base_shear_kN: float
    guy_tension_each_kN: float
    note: str


def analyze_mast_system(load_kN: float, mast_angle_deg: float, num_guys: int = 3, dynamic_factor: float = 1.1) -> DerrickSystem:
    """内悬浮外拉线抱杆系统整体受力（简化，均分到缆风绳）。"""

    theta = radians(mast_angle_deg)
    axial = load_kN * dynamic_factor / max(0.1, cos(theta))
    shear = load_kN * 0.25
    guy = shear / max(1, num_guys)
    return DerrickSystem(mast_axial_kN=axial, mast_base_shear_kN=shear, guy_tension_each_kN=guy, note="需空间受力与稳定复核")


